/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package 解析.node.charproperty.支持补集;

import 解析.ASCII;

/**
 *
 * @author yanxi
 */
public class Ctype extends BmpCharProperty {

    public final int ctype;

    public Ctype(int ctype) {
        this.ctype = ctype; 
    }
    
    @Override
    public boolean isSatisfiedBy正集 (int ch) {
        return ch < 128 && ASCII.isType(ch, ctype);
    }
  
    @Override
    public String toString正集(){
        switch(ctype){
            case 67328:return "\\w";
            case 1024:return "\\d";
            case 2048:return "\\s"; 
        }
        return "\\p{"+CharPropertyNames.mapCtype.get(ctype)+"}";
    } 
    @Override
    public String toString补集(){
        switch(ctype){
            case 67328:return "\\W";
            case 1024:return "\\D";
            case 2048:return "\\S"; 
        }
        return "\\P{"+CharPropertyNames.mapCtype.get(ctype)+"}";
    } 
}
